package DPT_19;

import LCommon.ListNode;

public class Solution {
	public ListNode removeNthFromEnd(ListNode head, int n) {
		ListNode dummy = new ListNode(-1);
		dummy.next = head;
		ListNode fast = dummy,slow = dummy;
		for (int i = 0; i <= n; i++) {
			fast= fast.next;
		}
		while (fast!=null) {
			fast=fast.next;
			slow = slow.next;
		}
		slow.next = slow.next.next;
		return dummy.next;
		
		
		
	}
}
